/**
 * 去哪儿旅行依赖版本号比较
 * 作者:夏天
 * qq:1205232048
 */
public class Main02 {
    public static void main(String[] args) {
        String v1 = "1.2.2.EESS";
        String v2 = "1.2.2.ES";
        System.out.println(compareVersion(v1, v2));
    }
    public static int compareVersion (String version1, String version2) {
        int out = 2;
        String[] ver1 = version1.split("\\.");
        int[] ver11 = new int[ver1.length];
        for(int i = 0; i < ver1.length; i++){
            ver11[i] = ver1[i].charAt(0);
        }
        String[] ver2 = version2.split("\\.");
        int[] ver22 = new int[ver2.length];
        for(int i = 0; i < ver2.length; i++){
            ver22[i] = ver2[i].charAt(0);
        }
        if(ver1.length < ver2.length){
            for(int i = 0; i < ver1.length; i++){
                if(ver11[i] == ver22[i]){
                    out = 0;
                }else {
                    if(ver11[i] > ver22[i]){
                        out = 1;
                        return out;
                    }else {
                        out = -1;
                        return out;
                    }
                }
            }
        }else {
            for(int i = 0; i < ver2.length; i++){
                if(ver11[i] == ver22[i]){
                    out = 0;
                }else {
                    if(ver11[i] > ver22[i]){
                        out = 1;
                        return out;
                    }else {
                        out = -1;
                        return out;
                    }
                }
            }
        }

        return out;
    }
}
